package com.es.designmode.simplefactory;

/**
 * 简单工厂
 * 简单运算工厂类
 *
 * @author Will
 */
public class OperationFactory {

    public static Operation creatOperation(char operate) {

        Operation operation = null;

        switch (operate) {
            case '+':
                operation = new OperationAdd();
                break;
            case '-':
                operation = new OperationSub();
                break;
            case '*':
                operation = new OperationMul();
                break;
            case '/':
                operation = new OperationDiv();
                break;
            default:
                break;
        }

        return operation;
    }
}
